#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int is_leap_year(int n)
{
	if (n % 400 == 0)return 1;
	if (n % 100 == 0)return 0;
	if (n % 4 == 0)return 1;
	return 0;
}
int main()
{
	int x = 0;
	int y = 0;
	scanf("%d%d", &x, &y);
	int count = 0;
	for (int i = x; i <= y; i++)
	{
		if (is_leap_year(i))count++;
	}printf("%d\n", count);
	for (int i = x; i <= y; i++)
	{
		if (is_leap_year(i))
			printf("%d ", i);
	}
	return 0;
}